<%@page contentType="text/html;charset=UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
	<title>Web Baesd Intelligent Tutoring System in Sudoku for Logic Training</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <%-- CSS is get from http://www.freelayouts.com/ --%>
    <link rel="stylesheet" type="text/css" href="css/default.css" title="default"/>
</head>

<body>
    <jsp:include page='header.jsp'/>


    <% String loginFormURL =
               "http://144.214.121.25:8080/SudokuITSWebsite/login.jsp";
    String user = (String) session.getAttribute("user");

    if(user == null) {
        response.setHeader("Refresh", "3; URL=" + loginFormURL);
        out.println(
            "<div class=\"article_body\">" +
            "<p><h2>" +
            "You have not login and will be redirected to the login page after 3 seconds. If not, press<a href=\"login.jsp\">here</a><br/>" +
            "您還沒登入！3秒後進入登入頁面.如沒有，請按<a href=\"login.jsp\">此</a><br/>" +
            "</h2></p>" +
            "</div>");
    }else{

    %>

        <div class="article_body">
            <p>
                <form action="AddPuzzle.jsp">
                    <table class="sudoku">
                    <%
                        for(int i=0; i<9; i++){
                            out.println("<tr>");
                            for(int j=0; j<9; j++){
                                int k = i*9+j+1;
                                out.println("<td>");
                                out.println("<input class=\"sudoku\" maxlength=\"1\" type=\"text\" name=\"" + k + "\" >");
                                out.println("</td>");
                            }
                            out.println("</tr>");
                        }
                    %>
                    </table>
                    <br/>
                    <input type="submit" class="submit" name="submit" value="Submit">
                    <br/>
                </form>
            </p>
            <p>
                Assume the Sudoku Puzzle Submit is Correct!
            </p>
        </div>


    <%
        
    }
    %>

     <jsp:include page='footer.jsp'/>
</body>
</html>